<template>
<div>
    <h1>车辆历史通行记录查看</h1>
      <div class="white">
        <h1>总览</h1>
      <div>
        <el-table
    :data="tableData"
    border
    style="width: 100%">
          <el-table-column
            fixed
            prop="rID"
            label="记录id">
          </el-table-column>
          <el-table-column
            prop="aEnd"
            label="打卡时间-终点">
          </el-table-column>
          <el-table-column
            prop="aProof"
            label="收费证据信息">
          </el-table-column>
          <el-table-column
            prop="aProvince"
            label="收费省份">
          </el-table-column>
          <el-table-column
            prop="aStart"
            label="打卡时间-起点">
          </el-table-column>
          <el-table-column
            prop="amount"
            label="金额">
          </el-table-column>
          <el-table-column
            prop="cId"
            label="车辆id">
          </el-table-column>
          <el-table-column
            prop="dpNum"
            label="车型">
          </el-table-column>
          <el-table-column
            prop="pEnd"
            label="目的地">
          </el-table-column>
          <el-table-column
            prop="pStart"
            label="出发地">
          </el-table-column>
          <el-table-column
            prop="status"
            label="状态">
          </el-table-column>
          <el-table-column
            prop="time"
            label="时间">
          </el-table-column>
          <el-table-column
            label="操作">
            <template slot-scope="scope">
              <el-button @click="toAppeal(scope.row)" type="primary" size="small" round>收费申诉</el-button>
            </template>
          </el-table-column>
  </el-table>
      </div>
    </div>
      </div>
</template>

<script>
  import axios from 'axios'
  import cookies from 'js-cookie'
  export default {
         data() {
      return {
         tableData: [{
          date: '2016-05',
          lincense: '赣NBzzzzz1',
          fee: '1546',
          sum:'36',
          state: '正常',
          time: '36.7h',
          zip: '轿车'
        }],
        options: [{
          value: '选项1',
          label: '兰博基尼'
        }, {
          value: '选项2',
          label: '劳斯莱斯',
        }, {
          value: '选项3',
          label: '凯迪拉克'
        }, {
          value: '选项4',
          label: '五菱宏光'
        }, {
          value: '选项5',
          label: '法拉利'
        }],
        pickerOptions: {
          shortcuts: [{
            text: '最近一周',
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
              picker.$emit('pick', [start, end]);
            }
          }, {
            text: '最近一个月',
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
              picker.$emit('pick', [start, end]);
            }
          }, {
            text: '最近三个月',
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
              picker.$emit('pick', [start, end]);
            }
          }]
        },
        value1:'',
        value2: ''
      };
    },
    mounted() {
      this.getInfo()
    },
    methods: {
      toAppeal(row){
        this.$router.push({path:'/FeeA',query:row})
      },
      async getInfo(){
        let mydata2={
          oId:cookies.get("id")
        }
        //获取车主
        axios.post('/owner-car/get',mydata2).then((res)=>{
          console.log(res)
          this.cId=res.data.data[0].cId
          console.log(this.cId)
          let mydata={
            cId:res.data.data[0].cId
          }
          axios.post('/car-record/get', mydata).then((res)=>{
            console.log(res)
            this.tableData=res.data.data
          })
        })

      }
    }
  }

</script>
